#include<stdio.h>
#include<stdlib.h>
#include<string.h>

// argv[1] is long str 
// argv[2] is the substr
//
int
main(int argc,char * argv[]){
	if(argc < 3){
		printf("Uage:%s <long_str><substr>\n",argv[0]);
		return EXIT_FAILURE;	
	}
	int count = 0;
	char * pos = argv[1];
	int substrlen = strlen(argv[2]);
	while((pos=strstr(pos,argv[2]))!=NULL){

		if(strlen(pos) > substrlen) pos = pos + substrlen;
		else pos++;
		count++;
	}
	printf("string=%s has substr=%s count=%d\n",argv[1],argv[2],count);
	return 0;
}
